const defaultValue ={
    msg:'1',
    title:'首页',
    list:['张三','李四','王五']
}

export default (state=defaultValue,actions)=>{
    let newState = JSON.parse(JSON.stringify(state));
    if(actions.type==='changeMsg'){
        newState.msg = actions.value
    }else if(actions.type==='addItem'){
        newState.list.unshift(actions.value);
        newState.msg=''
    }else if(actions.type==='delItem'){
        newState.list.splice(actions.value,1);
    }else if(actions.type==='getList'){
        newState.list = actions.data.list
    }else if(actions.type==='changeTitle'){
        newState.title = actions.value
    }
    return newState
}